/**
 * @FileName: CityCounter.java
 * @Author
 * @Description:
 * @Date 2016年5月16日 下午4:18:02
 * @CopyRight ZTE Corporation
 */
package cn.hpclub.server.model;

import java.io.Serializable;

import com.jfinal.ext.plugin.tablebind.TableBind;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Record;

@TableBind(tableName = "city_counter")
public class CityCounter extends Model<CityCounter> implements Serializable{

    // @Fields serialVersionUID :

    private static final long       serialVersionUID = 7600016574703372235L;

    public static final CityCounter dao              = new CityCounter();

    public static final String      POS_ID           = "pos_id";
    public static final String      PUB              = "pub";

    /**
     * @Title: getPub30
     * @Description:PUB大于30，截取后30位。小于30，截取全部。其他情况，返回空串
     * @param r
     * @return String
     */
    public static String getPub30(Record r){
        String pub30 = "";
        if(r == null){
            return pub30;
        }
        String pub = r.getStr(PUB);
        if((StrKit.notBlank(pub))){
            if(pub.length() > 30){
                pub30 = pub.substring(pub.length() - 30);
            } else{
                pub30 = pub;
            }
        }
        return pub30;
    }

    public static String getPosId(Record r){
        if(r == null){
            return "";
        }
        String posId = r.getStr(POS_ID);
        return (posId == null) ? "" : posId;

    }

}
